/*
 * \brief  Client-side timer session interface
 * \author Norman Feske
 * \date   2006-05-31
 */

/*
 * Copyright (C) 2006-2009 Norman Feske
 * Genode Labs, Feske & Helmuth Systementwicklung GbR
 *
 * This file is part of the Genode OS framework, which is distributed
 * under the terms of the GNU General Public License version 2.
 */

#ifndef _INCLUDE__TIMER_SESSION__CLIENT_H_
#define _INCLUDE__TIMER_SESSION__CLIENT_H_

#include <timer_session/capability.h>
#include <base/ipc.h>
#include <base/lock.h>

namespace Timer {

	class Session_client : public Session
	{
		private:

			Genode::Msgbuf<32> _snd_msg, _rcv_msg;
			Genode::Ipc_client _ipc_client;
			Genode::Lock       _lock;

		public:

			/**
			 * Constructor
			 */
			explicit Session_client(Session_capability session)
			: _ipc_client(session, &_snd_msg, &_rcv_msg) { }


			/*****************************
			 ** Timer session interface **
			 *****************************/

			void msleep(unsigned ms)
			{
				Genode::Lock::Guard lock_guard(_lock);
				_ipc_client << MSLEEP << ms << Genode::IPC_CALL;
			}
	};
}

#endif /* _INCLUDE__TIMER_SESSION__CLIENT_H_ */
